package com.xca.znb.model.impl;

import android.content.Context;

import com.xca.znb.database.UserDAO;
import com.xca.znb.entity.Cart;
import com.xca.znb.entity.Goods;
import com.xca.znb.model.imodel.IShoppingCart;

import java.util.List;

public class ShoppingCartImpl implements IShoppingCart {
    private UserDAO userDAO ;
    public ShoppingCartImpl(Context context){
        userDAO = new UserDAO(context);
    }
    @Override
    public List<Cart> getCartByPhone(String user) {
        return userDAO.getCartByPhone(user);
    }

    @Override
    public void deleteCartById(int id) {
        userDAO.deleteCartById(id);
    }

    @Override
    public Cart getCartById(int id) {
        return userDAO.getCartById(id);
    }

    @Override
    public void updateCartNumById(int id, int num) {
        userDAO.updateCartNumById(id, num);
    }

    @Override
    public Goods getGoodsById(int id) {
        return userDAO.getGoodsById(id);
    }

    @Override
    public int getLocalDefaultId(String phone) {
        return userDAO.getLocalDefaultId(phone);
    }

    @Override
    public void addOrUpdateFoot(int goodsId, String user, String time) {
        userDAO.addOrUpdateFoot(goodsId, user, time);
    }
}
